#include "event_handler.h"
#include "event_loop.h"
#include <unistd.h>

EventHandler::EventHandler(EventLoop& loop, int fd)
    : loop_(loop), fd_(fd) {}

EventHandler::~EventHandler() {
    closeFd();
}

void EventHandler::closeFd() {
    if (fd_ != -1) {
        ::close(fd_);
        fd_ = -1;
    }
}